//
//  videoBtn.m
//  ALS3.0
//
//  Created by guomianxiang on 17/1/5.
//  Copyright © 2017年 guomianxiang. All rights reserved.
//

#import "videoBtn.h"
#import "UIView+CHYExtension.h"
#import "UIView+LG.h"
@implementation videoBtn

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (void)layoutSubviews{
    
    
    [super layoutSubviews];
    
    
//    NSLog(@"%@======%@",self.titleLabel.text,NSStringFromCGRect(self.imageView.frame));
    
    
    self.imageView.center = CGPointMake(self.width / 2, self.height / 2 - (self.imageView.frame.size.width  * 0.5));
    
//    self.imageView.y = 32;
    
    self.titleLabel.center = CGPointMake(self.width / 2, self.height / 2);
    self.titleLabel.y = CGRectGetMaxY(self.imageView.frame) + 6;

    
    //设置文字颜色
    [self setTitleColor:[UIColor colorWithRed:63/255.0 green:235/255.0 blue:235/255.0 alpha:1] forState:UIControlStateSelected];
    
    
    if ([self.titleLabel.text isEqualToString:@"未关联门"]) {
        
        [self setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        
    } else{
        
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
}

- (void)layoutIfNeeded {
    [super layoutIfNeeded];
//    NSLog(@"layoutIfNeeded");
}

//取消高亮
- (void)setHighlighted:(BOOL)highlighted{
    
}

@end
